package models

import (
	"gin-easy/pkg/zap_log"
	"gorm.io/gorm"
)

type User struct {
	gorm.Model
	Phone    string
	Name     string
	Passward string
}

// 插入新用户
func UserCreate(data map[string]interface{}) bool {
	user := User{
		Name:     data["name"].(string),
		Passward: data["password"].(string),
		Phone:    data["phone"].(string),
	}
	res := db.Create(&user)
	if res.Error != nil {
		zap_log.Lg.Fatal("保存失败")
		return false
	}
	return true
}
